<?php
include '../db/sql.php';
include '../functions.php';
$dept_name = $_POST['dept_name'];
$name_str = "";
if(strcmp($dept_name,"ALL") == 0){
    $from = $db->query("SELECT RealName,Account from Base_User");
    while ($row = $from->fetch()){
        $name_str = $name_str . $row['RealName'] . "|" . $row['Account'] . ",";
    }
}
else{
    $name_array = from_dept_find_name($db,$dept_name);
    foreach ($name_array as $value){
        $name_str = $name_str . $value . ",";
    }
}
$name_str = rtrim($name_str,",");
echo $name_str;